package me.feng.dao

import org.hibernate.Session
import org.hibernate.cfg.AnnotationConfiguration


object SessionFactoryHelper {
  lazy val sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory()
  var _session: Session = _

  def getSession = if (_session != null && _session.isOpen()) _session else sessionFactory.openSession()

}